<div id="couponDetailApp" class="layui-card">
        <div class="layui-header notselect">
            <div class="pull-left"><span>优惠劵</span></div>
            <div class="pull-right margin-right-15 nowrap">
                <button data-open="/shop/coupon/index"  class="layui-btn layui-btn-sm layui-btn-primary">返回</button>
            </div>
        </div>
        <div class="layui-card-body">
            <form id="addCouponForm" action="/shop/coupon/ajax_add" autocomplete="off" class="layui-form layui-form-pane form-search" onsubmit="return false;">
            <table class="layui-table">
                <tr>
                    <td colspan="6" align="center">优惠劵信息</td>
                </tr>
                <tr>
                    <td>优惠形式</td>
                    <td>
                        {{getkey("preferentialWay",couponData.preferentialWay)}}
                    </td>
                    <td>
                        <span v-if="couponData.preferentialWay==1">{{couponData.quota}}元</span>
                        <span v-if="couponData.preferentialWay==2">{{couponData.discount}}折</span>

                    </td>
                    <td colspan="4">
                        {{getkey("overlying",couponData.overlying)}}
                    </td>
                </tr>
                <tr>
                    <td>编码</td>
                    <td >
                        {{couponData.code}}
                    </td>
                    <td>满减限制</td>
                    <td>
                        {{couponData.restrictionMoney}}
                    </td>
                    <td>领取限制</td>
                    <td >
                        {{couponData.drawLimit}}次
                    </td>
                </tr>
                <tr>
                <tr>
                    <td colspan="1">优惠劵类型</td>
                    <td colspan="1">
                        {{getkey("type",couponData.type)}}
                    </td>
                    <td v-if="couponData.type=='campaign'">
                        {{couponData.channel}}
                    </td>
                    <td v-if="couponData.type=='campaign'">
                        <input name="channel" v-model="couponData.channel" required="required" title="请填写渠道值(长度不超过50)" maxlength="50" placeholder="活动通道值" class="layui-input required">
                    </td>
                    <td>优惠劵名称</td>
                    <td colspan="3">
                        {{couponData.name}}
                    </td>
                </tr>
                <tr>
                    <td>有效期类型</td>
                    <td colspan="1">
                        {{getkey("dateType",couponData.dateType)}}
                    </td>
                    <td v-if="couponData.dateType=='interval'" colspan="4">
                        {{couponData.eifTime}}
                        到
                        {{couponData.expireTime}}
                    </td>
                    <td v-if="couponData.dateType=='countdown'" colspan="4">
                        {{couponData.countDownDay}}天
                    </td>
                </tr>
                <tr>
                    <td>总数/已领取/已使用</td>
                    <td colspan="5">
                        {{couponData.total}}/{{couponData.drawed}}/{{couponData.used}}
                    </td>
                </tr>
                <tr>
                    <td>备注</td>
                    <td colspan="5">
                        {{couponData.remark}}
                    </td>
                </tr>
            </table>
            </form>
        </div>
</div>
<script>
    require(['jquery', 'vue'], function (jquery, Vue) {
        var vue;
        var couponData;
        $.ajax({
            type : "POST",
            url : '/shop/coupon/ajax_detail',
            data :{id:$.getUrlParam("couponId")},
            dataType : "json",
            async:false,
            success : function(res) {
                couponData=res.data;
            }
        });
        vue=new Vue({
            el: '#couponDetailApp',
            data: {
                couponData:couponData
            },
            created: function () {
            },
            methods:{
                gernerateId: function (name,index){
                    return name+"_" +index
                }
            }
        });
        window.form.render();
    })
</script>